package thread;

public class ThreadDemo4 {
    public static void main(String[] args) {
        MyRunnable mr2=new MyRunnable();
//        Thread th2=new Thread(mr2);
        Thread th2=new Thread(mr2,"A:");
//        设置线程名称
//        th2.setName("A:");
        th2.start();
        for(int i=1;i<=1000;i++){
            System.out.println(Thread.currentThread().getName()+"--线程执行了"+i);
        }
    }
}

class MyRunnable2 implements Runnable{
    @Override
    public void run(){
        for(int i=1;i<=200;i++){
            System.out.println(Thread.currentThread().getName()+"线程任务执行了"+i);
        }
    }
}
